home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
qwik5x.zip
/
QWIKDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-12-19
|
24KB
|
707 lines
{ =========================================================================== }
{ QwikDemo.pas - Demo program for QWIK screen utilities. ver 5.x, 12-20-88 }
{ Demo has been programmed best for color cards in 25-line mode. }
{ =========================================================================== }
{ !! Do not use Ctrl-Break to terminate this program while in the }
{ TP integrated environment with integrated debugging on!! }
program QwikDemo;
{ R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ } { TP4 directives }
{$A-,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-} { TP5 directives }
{$M 12000, 0, 0}
uses
Crt,Qwik,Strs;
type
BrdrRec = record { For Qbox procedure }
TL,TH,TR,LV,RV,BL,BH,BR: char;
end;
var
Row,Rows,Col,Cols,Step,ColMax: byte;
i,Count,
Fgrnd,Bgrnd: word;
BrdrAttr, WndwAttr: integer;
SavedBlock, PopUpBlock: array [1..4000] of byte;
BlkRow,BlkCol,V: byte;
ColL,ColR: array [1..3] of byte;
Strng,Strng2: string[75];
Data: array [1..9 ] of string[40];
PC: array [1..14] of string[40];
Init: array [1..10] of string[40];
Other:array [1..12] of string[40];
Crsr: array [1..13] of string[40];
Eoss: array [1.. 4] of string[40];
Rnum: Real;
Ch: char;
LastVideoMode: byte;
const
Wait: word = 400; { One unit of wait in milliseconds for demo. }
{ These are double lines for Qbox }
Border: BrdrRec = (TL:'╔';TH:'═';TR:'╗';
LV:'║'; RV:'║';
BL:'╚';BH:'═';BR:'╝');
BWcolors: array[0..3] of byte = (
Black, { Black on Black }
LightGray, { LightGray on Black }
White, { White on Black }
LightGrayBG); { Black on LightGray }
{ Since Zenith doesn't have snow on any CGAs, turn off snow checking }
procedure CheckZenith;
var ZdsRom: array[1..8] of char absolute $F000:$800C;
begin
if Qsnow and (ZdsRom='ZDS CORP') then
begin
Qsnow := false;
CardSnow := false;
end;
end;
{ Qbox is an application of QWIK screen utilities. It can make fast
pop-up menus. See WNDWxx.ARC for more applications. }
procedure Qbox (Row,Col,Rows,Cols: byte; WndwAttr,BrdrAttr: integer;
Brdr: BrdrRec);
begin
if (Rows>=2) and (Cols>=2) then
begin
with Brdr do
begin
Qwrite (Row ,Col ,BrdrAttr,TL);
QfillEos ( 1,Cols-2,BrdrAttr,TH);
QwriteEos ( BrdrAttr,TR);
Qfill (Row+1 ,Col ,Rows-2,1 ,BrdrAttr,LV);
Qfill (Row+1 ,Col+Cols-1,Rows-2,1 ,BrdrAttr,RV);
Qwrite (Row+Rows-1,Col ,BrdrAttr,BL);
QfillEos ( 1,Cols-2,BrdrAttr,BH);
QwriteEos ( BrdrAttr,BR);
Qfill (Row+1 ,Col+1 ,Rows-2,Cols-2,WndwAttr,' ')
end
end
end;
procedure PromptKey;
begin
Qwrite (25,CRTcols-19,SameAttr,'press any key ...');
Ch := ReadKey;
end;
procedure ClearScreen (Attr: integer);
begin
Qfill ( 1, 1,CRTrows,CRTcols,Attr,' ');
end;
procedure ExplodeBoxes;
var
TopRow,BottomRow,MaxRows,MaxCols,DeltaCols,LeftCol,RightCol: byte;
CenterCol: byte;
ClockReading: word absolute $0040:$006C; { low memory clock }
StartTime: word;
{}procedure ScatterBoxes;
{}begin
{} Rows:= succ(random(MaxRows));
{} if QVideoMode<=CO40 then { Keep aspect 1:1 }
{} Cols:= Rows + Rows shr 2 { 1.2 cols/row }
{} else Cols:= Rows shl 1 + Rows shr 1; { 2.4 cols/row }
{} Col := LeftCol + random (RightCol-LeftCol-Cols+2);
{} Row := TopRow + random (BottomRow-TopRow-Rows+2);
{} if QVideoMode=Mono then
{} TextAttr:=BWcolors[(random(4))]
{} else
{} begin
{} Fgrnd:= random (16);
{} Bgrnd:= random (8);
{} if Bgrnd=Fgrnd then inc(Fgrnd);
{} TextAttr:=Fgrnd + Bgrnd shl 4;
{} end;
{} Qfill (Row,Col,Rows,Cols,TextAttr,#178);
{}end;
begin
CenterCol:=CRTcols shr 1;
randomize;
StartTime:=ClockReading;
for Step:=1 to 12 do
begin
{ Set boundaries }
TopRow:=13-Step;
BottomRow:=13+Step;
MaxRows:=Step;
if QVideoMode<=CO40 then { Keep aspect 1:1 }
begin
MaxCols:= MaxRows + MaxRows shr 2; { 1.2 cols/row }
DeltaCols:=(Step*5 div 3);
end
else
begin
MaxCols:= MaxRows shl 1 + MaxRows shr 1; { 2.4 cols/row }
DeltaCols:=(Step*10 div 3);
end;
LeftCol :=succ(CenterCol)-DeltaCols;
RightCol :=CenterCol+DeltaCols;
if Step<12 then
begin
for Count:=1 to 40 do ScatterBoxes;
end
else
repeat
ScatterBoxes;
until ClockReading-StartTime>=60; { about 60/18.2 seconds }
end;
end;
procedure InitDemo;
begin
{ --- Set up data --- }
{ If you set a mode, do it first before Qinit! }
{ Please! Test a mode first to see if it is different than what you want; }
{ then change if necessary. Otherwise, the screen jumps. }
CheckBreak := false;
CheckZenith;
LastVideoMode := QVideoMode;
if (QVideoMode<>Mono) and not Have3270 then
begin
ClearScreen (LightGray+BlackBG);
QwriteC (11,1,CRTcols,SameAttr,'(1) 40 column mode');
QwriteC (12,1,CRTcols,SameAttr,'(2) 80 column mode');
QwriteC (14,1,CRTcols,SameAttr,'Which mode [1,2]? ');
GotoEos;
repeat
Ch:=ReadKey;
until ch in ['1','2'];
V := QVideoMode;
case ch of
'1': case V of
BW80: V:=BW40;
CO80: V:=CO40;
end;
'2': case V of
BW40: V:=BW80;
CO40: V:=CO80;
end;
end;
if V<>QVideoMode then
begin
TextMode (V+hi(LastMode));
Qinit; { << Do Qinit again after change of mode!! }
CheckZenith;
end;
end;
ModCursor (CursorOff);
Strng:= ' Q Screen Utilities ';
Strng2:= ' QWIK Screen Utilities ';
Data[1]:= '1';
Data[2]:= '22';
Data[3]:= '333';
Data[4]:= Strng;
Data[5]:= 'Odd Length';
Data[6]:= 'Even Length';
Data[7]:= '18 characters wide';
Data[8]:= '19 characters width';
Data[9]:= 'Margin to Margin width';
PC[1]:= 'COMPUTERS: ADAPTERS:';
PC[2]:= '------------------ ----------';
PC[3]:= 'IBM PC MDA';
PC[4]:= 'IBM XT CGA';
PC[5]:= 'IBM AT EGA';
PC[6]:= 'IBM PCjr MCGA';
PC[7]:= 'IBM PC Convertible VGA';
PC[8]:= 'IBM PS/2 Model 25 8514/A';
PC[9]:= 'IBM PS/2 Model 30 Hercules:';
PC[10]:= 'IBM PS/2 Model 50 HGC';
PC[11]:= 'IBM PS/2 Model 60 HGC Plus';
PC[12]:= 'IBM PS/2 Model 70 InColor';
PC[13]:= 'IBM PS/2 Model 80';
PC[14]:= 'IBM 3270 PC';
Other[ 1]:='QscrollUp - Qwik scroll up';
Other[ 2]:='QscrollDown- Qwik scroll down';
Other[ 3]:='QscrToVscr - block to virtual screen';
Other[ 4]:='QVscrToScr - virtual screen to block';
Other[ 5]:='QreadStr - reads string from screen';
Other[ 6]:='QreadChar - reads char from screen';
Other[ 7]:='QreadAttr - reads attr from screen';
Other[ 8]:='QviewPage - view any video page';
Other[ 9]:='QwritePage - write to any video page';
Other[10]:='QwriteA - for arrays/partial strings';
Other[11]:='QfillC - a self-centering Qfill';
Other[12]:='QattrC - a self-centering Qattr';
Crsr[ 1]:='GotoRC - absolute cursor position';
Crsr[ 2]:='WhereR - absolute cursor row';
Crsr[ 3]:='WhereC - absolute cursor column';
Crsr[ 4]:='SetCursor - sets cursor mode';
Crsr[ 5]:='GetCursor - gets cursor mode';
Crsr[ 6]:='ModCursor - modifies cursor mode';
Crsr[ 7]:='CursorInitial - cu